{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "zwCKwR_TkwLy"
      },
      "source": [
        "# Transformers 4.56 vision models 🔥\n",
        "\n",
        "New transformers release comes with amazing vision/multimodal models: Florence-2 by MSFT, SAM-2 by Meta, KOSMOS-2.5 by MSFT, MetaCLIP2 by Meta, all runnable in Colab free tier. This notebook enables you to try them all!\n",
        "\n",
        "Note: This notebook has a lot of image outputs, so you need to run the notebook to see them. There's links at the end for each model's documentation, check them out for more inference options & info!"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "n5tkUIDAf6lW"
      },
      "source": [
        "## Florence-2\n",
        "\n",
        "We'll first take a look at Florence-2. The model in transformers format will be uploaded to microsoft org soon, but in the meantime, we can use the models `ducviet00/Florence-2-large-hf` and `ducviet00/Florence-2-base-hf`. It comes in sizes 200M and 800M parameters, very small."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "tNCPlyx4fksQ"
      },
      "outputs": [],
      "source": [
        "from transformers import AutoProcessor, AutoModelForImageTextToText\n",
        "import torch\n",
        "\n",
        "processor = AutoProcessor.from_pretrained(\"ducviet00/Florence-2-large-hf\")\n",
        "model = AutoModelForImageTextToText.from_pretrained(\"ducviet00/Florence-2-large-hf\").to(\"cuda\", torch.bfloat16)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ipCK8Qmvgz05"
      },
      "source": [
        "Florence-2 is a prompt based model, you can use following task prompts to use it:\n",
        "```\n",
        "<OCR>\n",
        "<OCR_WITH_REGION>\n",
        "<CAPTION>\n",
        "<DETAILED_CAPTION>\n",
        "<MORE_DETAILED_CAPTION>\n",
        "<OD>\n",
        "<DENSE_REGION_CAPTION>\n",
        "<CAPTION_TO_PHRASE_GROUNDING>\n",
        "<REFERRING_EXPRESSION_SEGMENTATION>\n",
        "<REGION_TO_SEGMENTATION>\n",
        "<OPEN_VOCABULARY_DETECTION>\n",
        "<REGION_TO_CATEGORY>\n",
        "<REGION_TO_DESCRIPTION>\n",
        "<REGION_TO_OCR>\n",
        "<REGION_PROPOSAL>\n",
        "```"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "JudF0LvsgInQ"
      },
      "outputs": [],
      "source": [
        "import torch\n",
        "import requests\n",
        "from PIL import Image\n",
        "\n",
        "url = \"https://huggingface.co/datasets/merve/vlm_test_images/resolve/main/menu.JPG\"\n",
        "image = Image.open(requests.get(url, stream=True).raw)\n",
        "prompt=\"<OCR>\""
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "s3oe_JZ0hiY5"
      },
      "outputs": [],
      "source": [
        "inputs = processor(text=prompt, images=image, return_tensors=\"pt\").to(\"cuda\", torch.bfloat16)\n",
        "\n",
        "generated_ids = model.generate(**inputs, max_new_tokens=1024, num_beams=3)\n",
        "\n",
        "generated_text = processor.batch_decode(generated_ids, skip_special_tokens=False)[0]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "vR6HQdDbhqf4",
        "outputId": "750f0535-6804-403e-98d7-da390d4a1be3"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "{'<OCR>': \"FRIDAY, DEC 20th\\nNEW OFFICE PARTY\\n- COCKTAIL MENU -\\nOFFICE MARTINI\\nvodka fraise des bois - liss de framboise - liqueur de fleur de surreau - fleur\\nwild strawberry volks - raspberry juice - raspberry litor - a déflower lior - flower\\nDIFFUSER'S SUNRISE\\ntequila, manchurian impédio, lus d'orange sansquine - contreu - cherry bitter\\ntequila, tangerine lime - blood orange juice - contreau - cherry bitter\\nTRANSFORMERS TWIST\\ngin Intégrale - chèvre-lemon - jauné - citron - pouvre blanc\\npepper\\nPERUVIAN PEFT\\nPapaya - lemonade - orange blanc - green tea & lemon - lemon - white\\npeppers - pomegranate - orange marmalade - ananas\\nplace - creme de crème - cérémonie - mandarin - mandarins\\nroasted mango-infused gin - lemongrass - grenadilla - orange cocktail - pineapple\"}\n"
          ]
        }
      ],
      "source": [
        "image_size = image.size\n",
        "parsed_answer = processor.post_process_generation(generated_text, task=prompt, image_size=image_size)\n",
        "print(parsed_answer)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "6jR5JacAilIM"
      },
      "source": [
        "You can also do object detection with it."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "FndxHptOinaC"
      },
      "outputs": [],
      "source": [
        "url = \"https://huggingface.co/datasets/merve/vlm_test_images/resolve/main/candy.JPG\"\n",
        "image = Image.open(requests.get(url, stream=True).raw)\n",
        "prompt = \"<OD>\"\n",
        "\n",
        "inputs = processor(text=prompt, images=image, return_tensors=\"pt\").to(\"cuda\", torch.bfloat16)\n",
        "\n",
        "generated_ids = model.generate(**inputs, max_new_tokens=1024, num_beams=3)\n",
        "\n",
        "generated_text = processor.batch_decode(generated_ids, skip_special_tokens=False)[0]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "I9dC1pxGjDJZ",
        "outputId": "de6c2001-caef-4184-8430-448815eabbb3"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "{'<OD>': {'bboxes': [[2272, 2085, 2659, 2453], [1925, 1335, 2296, 1707], [1651, 1431, 1961, 1788], [2457, 1915, 2840, 2193], [2009, 1955, 2388, 2187], [1155, 533, 3784, 3022]], 'labels': ['candy', 'candy', 'candy', 'candy', 'candy', 'human hand']}}\n"
          ]
        }
      ],
      "source": [
        "image_size = image.size\n",
        "parsed_answer = processor.post_process_generation(generated_text, task=prompt, image_size=image_size)\n",
        "print(parsed_answer)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "2mHFUOZVjZBo"
      },
      "outputs": [],
      "source": [
        "from PIL import ImageDraw\n",
        "\n",
        "draw = ImageDraw.Draw(image)\n",
        "bboxes = parsed_answer['<OD>']['bboxes']\n",
        "labels = parsed_answer['<OD>']['labels']\n",
        "\n",
        "for bbox, label in zip(bboxes, labels):\n",
        "    x1, y1, x2, y2 = bbox\n",
        "    draw.rectangle([x1, y1, x2, y2], outline=\"red\", width=3)\n",
        "    draw.text((x1, y1), label, fill=\"red\")\n",
        "\n",
        "display(image)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "NbSg8KeCnaJr"
      },
      "source": [
        "## DINOv3\n",
        "\n",
        "DINOv3 is an advanced image backbone/embedding model which you can use for variety of tasks as is. Here's a bunch of apps and tutorials in case you're interested in what you can do, and how to fine-tune it for image classification.\n",
        "- [DINOv3 Fine-tuning](https://huggingface.co/merve/smol-vision/blob/main/DINOv3_FT.ipynb)\n",
        "- [DINOv3 for Keypoint Matching through patch similarities](https://huggingface.co/spaces/merve/DINOv3-keypoint-matching)\n",
        "- [DINOv3 object perception](https://huggingface.co/spaces/merve/dinov3-viz)\n",
        "\n",
        "Note that to run this model, you need to have access to it. Head to repository to ask for access by filling the form if you don't have the access. [Here's all the DINOv3 models](https://huggingface.co/collections/facebook/dinov3-68924841bd6b561778e31009).\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "nfNxM7qrnZ4e"
      },
      "outputs": [],
      "source": [
        "import torch\n",
        "from transformers import AutoImageProcessor, AutoModel\n",
        "from transformers.image_utils import load_image\n",
        "\n",
        "url = \"https://huggingface.co/datasets/merve/vlm_test_images/resolve/main/thailand.jpg\"\n",
        "image = load_image(url)\n",
        "\n",
        "pretrained_model_name = \"facebook/dinov3-convnext-base-pretrain-lvd1689m\"\n",
        "processor = AutoImageProcessor.from_pretrained(pretrained_model_name)\n",
        "model = AutoModel.from_pretrained(\n",
        "    pretrained_model_name,\n",
        "    device_map=\"auto\",\n",
        ")\n",
        "\n",
        "inputs = processor(images=image, return_tensors=\"pt\").to(model.device)\n",
        "with torch.inference_mode():\n",
        "    outputs = model(**inputs)\n",
        "\n",
        "pooled_output = outputs.pooler_output\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "0wUqsaHAi2W5"
      },
      "source": [
        "## Kosmos 2.5\n",
        "\n",
        "Kosmos 2.5 by Microsoft is a great document model that can not only convert documents to markdown, it also can locate meaningful structures on documents and indicate parts of documents with bounding boxes. You can try [this demo](https://huggingface.co/spaces/nielsr/kosmos-2.5-demo) to see what it can do.\n",
        "It has a \"normal\" checkpoint and a \"chat\" checkpoint which can be used for VQA tasks. Let's see how to use it."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "Gjef-fw9fnuL"
      },
      "outputs": [],
      "source": [
        "from transformers import AutoProcessor, Kosmos2_5ForConditionalGeneration\n",
        "import torch\n",
        "\n",
        "model = Kosmos2_5ForConditionalGeneration.from_pretrained(\"microsoft/kosmos-2.5\").to(\"cuda\", torch.bfloat16)\n",
        "processor = AutoProcessor.from_pretrained(\"microsoft/kosmos-2.5\")\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "tPSqn-POl4up"
      },
      "outputs": [],
      "source": [
        "from PIL import Image, ImageDraw\n",
        "import requests\n",
        "\n",
        "url = \"https://huggingface.co/datasets/merve/vlm_test_images/resolve/main/fiche.jpg\"\n",
        "image = Image.open(requests.get(url, stream=True).raw)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "m2rgJrMPl-fE"
      },
      "source": [
        "It works a bit like Florence-2 where you can provide a task prompt. It takes two: `<md>` (for markdown) and `<ocr>` (for OCR)."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "YHBt0izHkPY5",
        "outputId": "0bdc32d0-3897-46ef-f897-b2208e1cc28d"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "# CATERIA DEI FERMENTINI\n",
            "\n",
            "UNO SRLS\n",
            "VIA CIMABUE 1 R\n",
            "50125 FIRENZE\n",
            "P.iva 04109381204\n",
            "Tel. 055 2466781\n",
            "\n",
            "## DOCUMENTO COMMERCIALE\n",
            "\n",
            "di vendita o prestazione\n",
            "\n",
            "- **QTA.** **DESCRIZIONE**\n",
            "- 1 x Coperti\n",
            "- 1 x Coca Fanta Sprite\n",
            "- 1 x Rigatoni 3 pomodori\n",
            "\n",
            "- **IVA**\n",
            "- 10,00%\n",
            "- 10,00%\n",
            "- 10,00%\n",
            "\n",
            "- **TOTAL** **EURO**\n",
            "- 17,00\n",
            "\n",
            "di cui **IVA**\n",
            "- 1.55\n",
            "\n",
            "Pagamento elettronico\n",
            "Importo pagato\n",
            "\n",
            "26-05-2023 21:52\n",
            "DOC.N. 0175-0011\n",
            "RT 941BQ003454\n",
            "\n",
            "---\n",
            "\n",
            "**DETTAGLIO FORME DI PAGAMENTO**\n",
            "Carta di Credito\n",
            "\n",
            "17,00\n"
          ]
        }
      ],
      "source": [
        "import re\n",
        "\n",
        "prompt = \"<md>\"\n",
        "inputs = processor(text=prompt, images=image, return_tensors=\"pt\")\n",
        "\n",
        "height, width = inputs.pop(\"height\"), inputs.pop(\"width\")\n",
        "raw_width, raw_height = image.size\n",
        "scale_height = raw_height / height\n",
        "scale_width = raw_width / width\n",
        "\n",
        "inputs = {k: v.to(\"cuda\") if v is not None else None for k, v in inputs.items()}\n",
        "inputs[\"flattened_patches\"] = inputs[\"flattened_patches\"].to(torch.bfloat16)\n",
        "generated_ids = model.generate(\n",
        "    **inputs,\n",
        "    max_new_tokens=1024,\n",
        ")\n",
        "\n",
        "generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)\n",
        "print(generated_text[0])"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "6jzqu6MvmfUO"
      },
      "source": [
        "Let's try chat version. Note how it takes a chat template as input."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "e39vlgY2mtHr"
      },
      "outputs": [],
      "source": [
        "model = Kosmos2_5ForConditionalGeneration.from_pretrained(\"microsoft/kosmos-2.5-chat\").to(\"cuda\", torch.bfloat16)\n",
        "processor = AutoProcessor.from_pretrained(\"microsoft/kosmos-2.5-chat\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "StNUuNufmetH",
        "outputId": "58d36158-c08c-4faf-897c-f9a83ce02760"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: What is the sub total of the receipt? ASSISTANT: 17,00\n"
          ]
        }
      ],
      "source": [
        "question = \"What is the sub total of the receipt?\"\n",
        "template = \"<md>A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: {} ASSISTANT:\"\n",
        "prompt = template.format(question)\n",
        "inputs = processor(text=prompt, images=image, return_tensors=\"pt\")\n",
        "\n",
        "# rest is the same\n",
        "height, width = inputs.pop(\"height\"), inputs.pop(\"width\")\n",
        "raw_width, raw_height = image.size\n",
        "scale_height = raw_height / height\n",
        "scale_width = raw_width / width\n",
        "\n",
        "inputs = {k: v.to(\"cuda\") if v is not None else None for k, v in inputs.items()}\n",
        "inputs[\"flattened_patches\"] = inputs[\"flattened_patches\"].to(torch.bfloat16)\n",
        "generated_ids = model.generate(\n",
        "    **inputs,\n",
        "    max_new_tokens=1024,\n",
        ")\n",
        "\n",
        "generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)\n",
        "print(generated_text[0])"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "uGD_FQbcpGYb"
      },
      "source": [
        "## MetaCLIP2\n",
        "\n",
        "MetaCLIP2 is a multimodal zero-shot image classifier by Meta, which you can use for a variety of tasks that require image-text understanding. [Here's all the MetaCLIP2 models](https://huggingface.co/collections/facebook/meta-clip-1-2-687e97787e9155bc480ef446), we will use the multilingual one."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "P0ESRMJOpUNW"
      },
      "outputs": [],
      "source": [
        "from transformers import AutoProcessor, AutoModelForZeroShotImageClassification\n",
        "import torch\n",
        "\n",
        "model = AutoModelForZeroShotImageClassification.from_pretrained(\"facebook/metaclip-2-worldwide-huge-378\", dtype=torch.bfloat16, attn_implementation=\"sdpa\").to(\"cuda\", torch.bfloat16)\n",
        "processor = AutoProcessor.from_pretrained(\"facebook/metaclip-2-worldwide-huge-378\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "VbHH5RQ2qzlo"
      },
      "outputs": [],
      "source": [
        "import requests\n",
        "import torch\n",
        "from PIL import Image\n",
        "\n",
        "url = \"https://huggingface.co/datasets/merve/vlm_test_images/resolve/main/venice.jpg\"\n",
        "image = Image.open(requests.get(url, stream=True).raw)\n",
        "labels = [\"venice\", \"venezia\", \"berlin\"]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "XjCTXKWCmWdI"
      },
      "outputs": [],
      "source": [
        "inputs = processor(text=labels, images=image, return_tensors=\"pt\", padding=True, ).to(\"cuda\")\n",
        "\n",
        "outputs = model(**inputs)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "zZrVdIKltzFw"
      },
      "source": [
        "We take the probabilities assigned to labels \"venice\", \"venezia\", \"berlin\" respectively."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "L4X8lu7MroNt",
        "outputId": "bab3453d-5846-4518-be23-92cdc0d9e5a1"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "['59.38%', '40.82%', '0.00%']\n"
          ]
        }
      ],
      "source": [
        "logits_per_image = outputs.logits_per_image\n",
        "probs = logits_per_image.softmax(dim=1)\n",
        "\n",
        "formatted_probs = [f\"{p.item()*100:.2f}%\" for p in probs[0]]\n",
        "print(formatted_probs)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "G5Jpbb4HuSLW"
      },
      "source": [
        "## SAM2\n",
        "\n",
        "SAM2 is continuation for SAM (Segment Anything Model) by Meta, with addition of video inference and keeping additional memory across video frames to propagate a mask to next frames."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "from transformers import Sam2Processor, Sam2Model\n",
        "import torch\n",
        "\n",
        "model = Sam2Model.from_pretrained(\"facebook/sam2-hiera-tiny\").to(\"cuda\")\n",
        "processor = Sam2Processor.from_pretrained(\"facebook/sam2-hiera-tiny\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Lq1rM5JWvPaq"
      },
      "source": [
        "Image inference is pretty similar to previous SAM model where you can provide a point of box prompt around object of interest.\n",
        "\n",
        "On top of it, you can indicate what type of click you're leaving on the image, i.e. 1 is positive click to indicate it's the object you're interested in, and 0 is negative click to exclude an object. Here we leave a positive click on a flower petal."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "kxbraMeuvMni"
      },
      "outputs": [],
      "source": [
        "from PIL import Image\n",
        "import requests\n",
        "\n",
        "image_url = \"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee_edited.jpg\"\n",
        "raw_image = Image.open(requests.get(image_url, stream=True).raw).convert(\"RGB\")\n",
        "\n",
        "input_points = [[[[750, 750]]]]\n",
        "input_labels = [[[1]]]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "2hHfoxyN2B1G"
      },
      "outputs": [],
      "source": [
        "from PIL import ImageDraw\n",
        "img = raw_image.copy()\n",
        "draw = ImageDraw.Draw(img)\n",
        "\n",
        "draw.regular_polygon((750, 750, 25), n_sides=3, fill=\"yellow\")\n",
        "img"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "LZ1fD_VTvLdV"
      },
      "outputs": [],
      "source": [
        "inputs = processor(images=raw_image, input_points=input_points, input_labels=input_labels, return_tensors=\"pt\").to(\"cuda\")\n",
        "\n",
        "with torch.no_grad():\n",
        "    outputs = model(**inputs)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "b0Jc5LmmPl3i"
      },
      "source": [
        "Outputs have prediction masks and `iou_scores`. We return three masks, so we can access best prediction through scores."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "0mRS1uGWPieQ",
        "outputId": "abb87538-5a2f-4be8-9a7e-fa860b872321"
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "tensor([[[0.3297, 0.7263, 0.4257]]], device='cuda:0')"
            ]
          },
          "execution_count": 10,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "outputs.iou_scores"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "1ppw1oL2Phwe"
      },
      "outputs": [],
      "source": [
        "masks = processor.post_process_masks(outputs.pred_masks.cpu(), inputs[\"original_sizes\"])[0]\n",
        "\n",
        "print(f\"Generated {masks.shape[1]} masks with shape {masks.shape}\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "SZfhmppfvkJh"
      },
      "source": [
        "Let's overlay the mask at the index 1 (with score 0.72)."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "EWw0bDTBvYQK"
      },
      "outputs": [],
      "source": [
        "import numpy as np\n",
        "from PIL import Image, ImageDraw\n",
        "\n",
        "binary_mask = masks[0][1]\n",
        "\n",
        "colored_mask = Image.fromarray(binary_mask.numpy().astype(np.uint8) * 255, mode='L').convert('RGBA')\n",
        "\n",
        "overlay_color = (255, 0, 0, 128)\n",
        "color_overlay = Image.new('RGBA', colored_mask.size, overlay_color)\n",
        "\n",
        "colored_mask.paste(color_overlay, (0, 0), color_overlay)\n",
        "\n",
        "raw_image_rgba = raw_image.convert('RGBA')\n",
        "\n",
        "output_image = Image.composite(colored_mask, raw_image_rgba, colored_mask)\n",
        "\n",
        "display(output_image)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "xyoxnJS2QK0L"
      },
      "source": [
        "With SAM2 you can do:\n",
        "- inference for single points per object per image → `[[[[500, 375]]]]` (single point)\n",
        "- inference for multiple points for one object in an image → `[[[[500, 375], [1125, 625]]]]`\n",
        "- multiple points per multiple objects → `[[[[500, 375]], [[650, 750]]]]`\n",
        "- batch images for above. → `[[[[500, 375]]], [[[770, 200]]]]` we should provide same for click indicators, e.g. for this case `[[[1]], [[1]]]`\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "0q1SKPIcQH5K"
      },
      "source": [
        "What makes SAM2 stand out is video tracking. We select a frame in a video, leave a click, get a mask. Then we propagate that mask across video itself, it's called a \"masklet\" and is tracked throughout the video with memory, so we need to start an inference session, unlike any other transformers model.\n",
        "\n",
        "Let's install av for the video backend, so let's install that."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "!pip install av"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "8_U1HYqkRNtp"
      },
      "outputs": [],
      "source": [
        "from transformers import Sam2VideoModel, Sam2VideoProcessor, infer_device\n",
        "import torch\n",
        "\n",
        "device = infer_device()\n",
        "model = Sam2VideoModel.from_pretrained(\"facebook/sam2.1-hiera-tiny\").to(device, dtype=torch.bfloat16)\n",
        "processor = Sam2VideoProcessor.from_pretrained(\"facebook/sam2.1-hiera-tiny\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "ZF-ANJiLRTjE"
      },
      "outputs": [],
      "source": [
        "from transformers.video_utils import load_video\n",
        "video_url = \"https://huggingface.co/datasets/hf-internal-testing/sam2-fixtures/resolve/main/bedroom.mp4\"\n",
        "video_frames, _ = load_video(video_url)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "ZG-QowjvSGVW"
      },
      "outputs": [],
      "source": [
        "display(video_frames[0])"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "t3cBdow8SDwq"
      },
      "source": [
        "We have video of jumping kids. Let's start video session."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "6HZUQjytSBfd"
      },
      "outputs": [],
      "source": [
        "inference_session = processor.init_video_session(\n",
        "    video=video_frames,\n",
        "    inference_device=device,\n",
        "    dtype=torch.bfloat16,\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "creXB8N8STm5"
      },
      "source": [
        "We leave a point on the first frame on the kid's pants."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "RdAy8fwQSSSF"
      },
      "outputs": [],
      "source": [
        "ann_frame_idx = 0\n",
        "ann_obj_id = 1\n",
        "points = [[[[210, 350]]]]\n",
        "labels = [[[1]]]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "132QpoZDScgw"
      },
      "outputs": [],
      "source": [
        "x, y = points[0][0][0][0], points[0][0][0][1]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "RIKrtivuSawU"
      },
      "outputs": [],
      "source": [
        "from PIL import ImageDraw, Image\n",
        "img = Image.fromarray(video_frames[0]).copy()\n",
        "draw = ImageDraw.Draw(img)\n",
        "\n",
        "draw.regular_polygon((x, y, 5), n_sides=3, fill=\"yellow\")\n",
        "img"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "6V5JQ7pqS4GG"
      },
      "outputs": [],
      "source": [
        "processor.add_inputs_to_inference_session(\n",
        "    inference_session=inference_session,\n",
        "    frame_idx=ann_frame_idx,\n",
        "    obj_ids=ann_obj_id,\n",
        "    input_points=points,\n",
        "    input_labels=labels,\n",
        ")\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "fhhtCRo2S6hR",
        "outputId": "070f7b3e-48c0-46a1-f3cb-115a9e77fa97"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Segmentation shape: torch.Size([1, 1, 540, 960])\n"
          ]
        }
      ],
      "source": [
        "outputs = model(\n",
        "    inference_session=inference_session,\n",
        "    frame_idx=ann_frame_idx,\n",
        ")\n",
        "video_res_masks = processor.post_process_masks(\n",
        "    [outputs.pred_masks], original_sizes=[[inference_session.video_height, inference_session.video_width]], binarize=True\n",
        ")[0]\n",
        "print(f\"Segmentation shape: {video_res_masks.shape}\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "WkPtbbIVTE96"
      },
      "outputs": [],
      "source": [
        "import numpy as np\n",
        "from PIL import Image, ImageDraw\n",
        "\n",
        "\n",
        "colored_mask = Image.fromarray(video_res_masks[0][0].cpu().detach().numpy().astype(np.uint8) * 255, mode='L').convert('RGBA')\n",
        "\n",
        "overlay_color = (255, 0, 0, 128)\n",
        "color_overlay = Image.new('RGBA', colored_mask.size, overlay_color)\n",
        "\n",
        "colored_mask.paste(color_overlay, (0, 0), color_overlay)\n",
        "\n",
        "raw_image_rgba = Image.fromarray(video_frames[0]).convert('RGBA')\n",
        "\n",
        "output_image = Image.composite(colored_mask, raw_image_rgba, colored_mask)\n",
        "\n",
        "display(output_image)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "UUDxiTLIS9bw"
      },
      "source": [
        "We can overlay the mask for that frame and if we like that, we propagate it in the video."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "S5OjPWguQDnv"
      },
      "outputs": [],
      "source": [
        "video_segments = {}\n",
        "for sam2_video_output in model.propagate_in_video_iterator(inference_session):\n",
        "    video_res_masks = processor.post_process_masks(\n",
        "        [sam2_video_output.pred_masks], original_sizes=[[inference_session.video_height, inference_session.video_width]], binarize=True\n",
        "    )[0]\n",
        "    video_segments[sam2_video_output.frame_idx] = video_res_masks\n",
        "\n",
        "print(f\"Tracked object through {len(video_segments)} frames\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "pY3tuQ0dUyTE"
      },
      "source": [
        "Let's check a random frame and see if the object was tracked properly."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "eX-_Cl9jVMQA",
        "outputId": "2ab6a027-9467-4183-875b-a55cd874d862"
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "tensor([[False, False, False,  ..., False, False, False],\n",
              "        [False, False, False,  ..., False, False, False],\n",
              "        [False, False, False,  ..., False, False, False],\n",
              "        ...,\n",
              "        [False, False, False,  ..., False, False, False],\n",
              "        [False, False, False,  ..., False, False, False],\n",
              "        [False, False, False,  ..., False, False, False]], device='cuda:0')"
            ]
          },
          "execution_count": 41,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "video_segments[100][0][0]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "Q5tEUlNUUWKL"
      },
      "outputs": [],
      "source": [
        "import numpy as np\n",
        "from PIL import Image, ImageDraw\n",
        "\n",
        "\n",
        "colored_mask = Image.fromarray(video_segments[110][0][0].cpu().detach().numpy().astype(np.uint8) * 255, mode='L').convert('RGBA')\n",
        "\n",
        "overlay_color = (255, 0, 0, 128)\n",
        "color_overlay = Image.new('RGBA', colored_mask.size, overlay_color)\n",
        "\n",
        "colored_mask.paste(color_overlay, (0, 0), color_overlay)\n",
        "\n",
        "raw_image_rgba = Image.fromarray(video_frames[110]).convert('RGBA')\n",
        "\n",
        "output_image = Image.composite(colored_mask, raw_image_rgba, colored_mask)\n",
        "\n",
        "display(output_image)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "N3Yp8BZNd7aM"
      },
      "source": [
        "## Docs\n",
        "Get more info in below links!\n",
        "- [SAM2 docs](https://huggingface.co/docs/transformers/main/en/model_doc/sam2)\n",
        "- [KOSMOS2.5 docs](https://huggingface.co/docs/transformers/main/en/model_doc/kosmos2_5)\n",
        "- [Florence-2 docs](https://huggingface.co/docs/transformers/main/en/model_doc/florence2)\n",
        "- [DINOv3 docs](https://huggingface.co/docs/transformers/main/en/model_doc/dinov3)\n",
        "- [MetaCLIP2 docs](https://huggingface.co/docs/transformers/main/en/model_doc/metaclip_2)"
      ]
    }
  ],
  "metadata": {
    "accelerator": "GPU",
    "colab": {
      "gpuType": "T4",
      "provenance": []
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    },
    "widgets": {
      "application/vnd.jupyter.widget-state+json": {
        "0273e9d39a2e496cb8e69743f53b9586": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "08314c4da2774b7ebac8b3f3a1e93f72": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "11bb77f6817b46d68dd6d472fc4e94fe": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "19d7db5882b54be9bd371dc123248c3e": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "2890e106c2954fa3b35bd1f1c3964d9f": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_ad318f6157a046f29ee41fe8fee3095f",
            "placeholder": "​",
            "style": "IPY_MODEL_d62bfbcce48e4067b9c9d8792722eaca",
            "value": "Fetching 2 files: 100%"
          }
        },
        "2bc336c59d4d4455a3bccfb0b7aa53ca": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "2e15e10fece246d7a9e1c0685207487e": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HBoxModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_81f5c3b043304f50857d3df7e75de7a8",
              "IPY_MODEL_5b9c0e9cca804e6c8ca44682812621a6",
              "IPY_MODEL_cdbc7efa2d3842a892db862a4b1bc2b9"
            ],
            "layout": "IPY_MODEL_3674b7b8076b4b2988fc9e14fd75ef2e"
          }
        },
        "343c9a6e82444bacb0baa2ac96c8b00f": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "FloatProgressModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_353d43de98434a9eb2cf0fb39b6d5bb8",
            "max": 95,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_51f2f230271f4894b254f1f5cee2773d",
            "value": 95
          }
        },
        "353d43de98434a9eb2cf0fb39b6d5bb8": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "3674b7b8076b4b2988fc9e14fd75ef2e": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "3a2f80b1640a4ff893bb88d20954a6bc": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "3c78030ee62043589cf1f83644a6eba8": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "40091ea3563442aa934c1976232af538": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "41c2832a1fce49688260b05cfdd18c24": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "ProgressStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "43b2b6d4320e40c498c924f11de65058": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": "20px"
          }
        },
        "4f21f33a8d3746459ebd51f9f671dd94": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "517804613ac140eaaea5f58f2667332a": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HBoxModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_d0273c4db9f54143a765c683eca5442a",
              "IPY_MODEL_be2ac1c412534e8c8781232803861bfa",
              "IPY_MODEL_fb55ada03e0a4e89b46f931ca2c54551"
            ],
            "layout": "IPY_MODEL_ecc7f1d03a6c4bdeadf1547528123dac"
          }
        },
        "51934c86e44743d587c990c259d3cfa1": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "51f2f230271f4894b254f1f5cee2773d": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "ProgressStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "5b9c0e9cca804e6c8ca44682812621a6": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "FloatProgressModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_3a2f80b1640a4ff893bb88d20954a6bc",
            "max": 155841672,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_41c2832a1fce49688260b05cfdd18c24",
            "value": 155841672
          }
        },
        "5f452103369c4a5da5254ce45da10b27": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HBoxModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_2890e106c2954fa3b35bd1f1c3964d9f",
              "IPY_MODEL_996626dbcbaa4c10a4a56f09ff1ed107",
              "IPY_MODEL_b417c2d8048649588b1e223ceb1f1bf1"
            ],
            "layout": "IPY_MODEL_19d7db5882b54be9bd371dc123248c3e"
          }
        },
        "606690bc2544411daec9b00316c08381": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "634c5fa2670c4a80902931ef0801c962": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_3c78030ee62043589cf1f83644a6eba8",
            "placeholder": "​",
            "style": "IPY_MODEL_4f21f33a8d3746459ebd51f9f671dd94",
            "value": " 95.0/95.0 [00:00&lt;00:00, 6.41kB/s]"
          }
        },
        "63796f030a32458385a6a30f59a28c97": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "666f9b45b7ee405bb703b621c1ba5f80": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "690b55661f7f46259e4b7af13adee811": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "7c60afe93d114c8388c3f6d69b2f0145": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "7e83a3d6ebe44556a403a79c4dc2f3df": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "81f5c3b043304f50857d3df7e75de7a8": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_0273e9d39a2e496cb8e69743f53b9586",
            "placeholder": "​",
            "style": "IPY_MODEL_9daacec65c204a338a6f5ce7d53b479f",
            "value": "model.safetensors: 100%"
          }
        },
        "81f9852cfa7f43178def864d20003f59": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HBoxModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_fadf7de524fe494db2f1691a42fd05c9",
              "IPY_MODEL_343c9a6e82444bacb0baa2ac96c8b00f",
              "IPY_MODEL_634c5fa2670c4a80902931ef0801c962"
            ],
            "layout": "IPY_MODEL_944dd815db3944f485ddba171268db23"
          }
        },
        "88ca8fc4f45140f7bca5e66f1edf351d": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "8f9bd5f6821c4c4ba88bc32f648fd79b": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_88ca8fc4f45140f7bca5e66f1edf351d",
            "placeholder": "​",
            "style": "IPY_MODEL_7c60afe93d114c8388c3f6d69b2f0145",
            "value": " 5.70k/? [00:00&lt;00:00, 505kB/s]"
          }
        },
        "9379b87fc3e948809f1f11e4bc816b1d": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "93b2328283cf4d08ad8c7407ed7e05af": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "ProgressStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "944dd815db3944f485ddba171268db23": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "996626dbcbaa4c10a4a56f09ff1ed107": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "FloatProgressModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_690b55661f7f46259e4b7af13adee811",
            "max": 2,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_9e43e8c6438f449f9d7f2fd313ddbda2",
            "value": 2
          }
        },
        "9d34c25eb34c467eac6d8fd80750a536": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "9daacec65c204a338a6f5ce7d53b479f": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "9e43e8c6438f449f9d7f2fd313ddbda2": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "ProgressStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "9f0ac8d10dcf4af3a3cfd0b3184505d1": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "a9b80ef3b2664eca94f42c2db2cf478c": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "ad318f6157a046f29ee41fe8fee3095f": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "b417c2d8048649588b1e223ceb1f1bf1": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_7e83a3d6ebe44556a403a79c4dc2f3df",
            "placeholder": "​",
            "style": "IPY_MODEL_2bc336c59d4d4455a3bccfb0b7aa53ca",
            "value": " 2/2 [00:00&lt;00:00,  2.71it/s]"
          }
        },
        "ba6fa0c793514fb48d772966bdadb183": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "ProgressStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "bdd292d1769449dd80b00c540885738b": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HBoxModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_c17c36edba134b999fc2449c2cf3d469",
              "IPY_MODEL_bf14f6cc11934619aea6e80f71d3237a",
              "IPY_MODEL_8f9bd5f6821c4c4ba88bc32f648fd79b"
            ],
            "layout": "IPY_MODEL_a9b80ef3b2664eca94f42c2db2cf478c"
          }
        },
        "be2ac1c412534e8c8781232803861bfa": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "FloatProgressModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_08314c4da2774b7ebac8b3f3a1e93f72",
            "max": 683,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_ba6fa0c793514fb48d772966bdadb183",
            "value": 683
          }
        },
        "bf14f6cc11934619aea6e80f71d3237a": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "FloatProgressModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_43b2b6d4320e40c498c924f11de65058",
            "max": 1,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_93b2328283cf4d08ad8c7407ed7e05af",
            "value": 1
          }
        },
        "c17c36edba134b999fc2449c2cf3d469": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_ebafeb6e5d26417290d79e23b1d7960a",
            "placeholder": "​",
            "style": "IPY_MODEL_63796f030a32458385a6a30f59a28c97",
            "value": "config.json: "
          }
        },
        "cdbc7efa2d3842a892db862a4b1bc2b9": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_9d34c25eb34c467eac6d8fd80750a536",
            "placeholder": "​",
            "style": "IPY_MODEL_11bb77f6817b46d68dd6d472fc4e94fe",
            "value": " 156M/156M [00:08&lt;00:00, 16.4MB/s]"
          }
        },
        "d0273c4db9f54143a765c683eca5442a": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_9f0ac8d10dcf4af3a3cfd0b3184505d1",
            "placeholder": "​",
            "style": "IPY_MODEL_51934c86e44743d587c990c259d3cfa1",
            "value": "preprocessor_config.json: 100%"
          }
        },
        "d62bfbcce48e4067b9c9d8792722eaca": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "ebafeb6e5d26417290d79e23b1d7960a": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "ecc7f1d03a6c4bdeadf1547528123dac": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "fadf7de524fe494db2f1691a42fd05c9": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_606690bc2544411daec9b00316c08381",
            "placeholder": "​",
            "style": "IPY_MODEL_40091ea3563442aa934c1976232af538",
            "value": "processor_config.json: 100%"
          }
        },
        "fb55ada03e0a4e89b46f931ca2c54551": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_666f9b45b7ee405bb703b621c1ba5f80",
            "placeholder": "​",
            "style": "IPY_MODEL_9379b87fc3e948809f1f11e4bc816b1d",
            "value": " 683/683 [00:00&lt;00:00, 80.6kB/s]"
          }
        }
      }
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}
